<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<?php if($form->getObject()->isNew()){
	throw new Exception("this form only acept edit mode");
}?>
<div>
<form action="<?php echo url_for('publication_prices/updatePricesByPublication?id='.$form->getObject()->getId()) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <table>
    <tfoot>
      <tr>
        <td colspan="2">
          &nbsp;<a href="<?php echo url_for('publication_prices/index') ?>">Back to list</a>
          <?php if (!$form->getObject()->isNew()): ?>
            &nbsp;<?php echo link_to('Delete', 'publication_prices/delete?id='.$form->getObject()->getId(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?>
          <?php endif; ?>
          <input type="submit" value="Save" />
        </td>
      </tr>
    </tfoot>
    <tbody>
      <?php echo $form ?>
    </tbody>
  </table>
</form>
</div>
<div id="form_new_price" style="width: 400px">
	<form  action="<?php echo url_for("publication_prices/create?id={$form->getObject()->getId()}")?>" method="post">
	<p><strong>Warning:</strong> Procure haber guardado toda la información del formulario principal antes de agregar un nuevo precio, la información que no haya sido guardada se perderá. </p>
		<table style="width: 100%">
		<?php echo $form_new?>
		</table>
	</form>
</div>
<script type="text/javascript">
(function($){
	$("ul.radio_list").buttonset();
	$("#form_new_price").dialog({modal:true,
								 autoOpen:true,
								 width: "500px",
								 
								 buttons:{
									 		"Guardar": function(ui){ $(this).find("form").submit(); },
											"cancelar": function(){$(this).dialog("close");}
 										 }
								}
								);
	
})(jQuery);
</script>
<?php //echo $form->getObject()->getPublicationPrices()->get(0)->buildNewCustomization()?>